﻿/**
 * SVNAddTemplateViewModel
 * 解析SVN项目模板
 * @Author:ZuiHong
 * @Date:2018/08/29 10:09
 **/
namespace metro_wpf.Function
{
    using System;
    using System.IO;
    using System.Windows.Media;

    public abstract class AbstractResolveProjectTemplate{

        /// <summary>
        /// Temp存放路径
        /// </summary>
        //public string TemplateTempFolder
        //{
        //    get { return Properties.Settings.Default.SVNProjectXMLPath; }
        //    set
        //    {
        //        Properties.Settings.Default.SVNProjectXMLPath = value;
        //        Properties.Settings.Default.Save();
        //    }
        //}

        /// <summary>
        /// 初始化配置
        /// </summary>
        public virtual void InitProjectTemplate()
        {
            //FileInfo fileInfo = new FileInfo(TemplateTempFolder);
            //if (fileInfo.Exists)
            //{
                
            //}
            //else
            //{
                
            //}
        }

        /// <summary>
        /// 删除模板
        /// </summary>
        protected abstract void DeleteResolvePorjectTemplate();

        /// <summary>
        /// 新增模板
        /// </summary>
        protected abstract void AddResolveProjectTemplate();

        /// <summary>
        /// 刷新缓存
        /// </summary>
        private void RefreshCache()
        {
            
        }
    }

    public class ResolveProjectTemplate : AbstractResolveProjectTemplate
    {
        public ResolveProjectTemplate()
        {
        }

        public override void InitProjectTemplate()
        {
            base.InitProjectTemplate();
        }

        protected override void AddResolveProjectTemplate()
        {
            
        }

        protected override void DeleteResolvePorjectTemplate()
        {
            
        }
    }

    /**
     * 随机生成磁贴背景色
     * @Author:ZuiHong
     * @Date:2018/08/29 10:09
     **/
    public class RandomTileColor
    {
        
        private RandomTileColor() { }

        /// <summary>
        /// R : 255 * 1/3 -> 255 * 2/3
        /// G : 255 * 1/3 -> 255 * 2/3
        /// B : 255 * 1/3 -> 255 * 2/3
        /// </summary>
        /// <returns>Color</returns>
        [Obsolete]
        public static Color TileColor()
        {
            Random ColorRandom = new Random();
            Color color = new Color();
            color.R = (byte)ColorRandom.Next((255 / 3) * 0, (255 / 3) * 2 + 30);
            color.G = (byte)ColorRandom.Next((255 / 3) * 0, (255 / 3) * 2 + 30);
            color.B = (byte)ColorRandom.Next((255 / 3) * 0, (255 / 3) * 2 - 20);
            color.A = 255;
            return color;
        }
    }
}
